import Router from 'vue-router'
Vue.use(Router)


// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;

// push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalReplace.call(this, location, onResolve, onReject);
  return originalReplace.call(this, location).catch(err => err);
};


export default new Router({
	mode: 'history',
	base: '/h5',

	routes: [
    {
      path: '/',
      redirect:'/index'
    },

    {
        path: '/index',
        component: () => import('@/wang/index'),
        mete:{
          title:"首页",
        }
    },

    {
        path: '/geren',
        component: () => import('@/wang/geren'),
        mete:{
          title:"个人中心",
        }
    },

    {
        path: '/tixianjilu',
        component: () => import('@/wang/tixianjilu'),
        mete:{
          title:"提现记录",
        }
    },

    {
        path: '/yaoqingjilu',
        component: () => import('@/wang/yaoqingjilu'),
        mete:{
          title:"邀请记录",
        }
    },

    {
        path: '/zhifubao',
        component: () => import('@/wang/zhifubao'),
        mete:{
          title:"支付宝",
        }
    }
	]
})
